<template>
  <div @click="Tabclick">
    <div v-if="TabberShow">
      <slot name="icon_act"></slot>
    </div>
    <div class="Tab" v-else>
      <!-- 使用V-if 判断每次路由选中 显示图标 -->
      <slot name="icon"></slot>
    </div>
    <div :class="TabberShow?'TabTitles':'TabTitle'">
      <slot name="title" ></slot>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    path: {
      type: String,
      required: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    Tabclick() {
      this.$router.push(this.path);
    },
  },
  computed: {
    TabberShow: function () {
      return this.path === this.$route.path;
    },
  },
};
</script>
<style scoped>
.Tab img {
  width: 1.3rem;
  height: 1.3rem;
}
.TabTitle {
  color: black;
}
.TabTitles{
  color: red;
}
</style>